/*
 * grid属性集合，用以保存grid数据
 */

function gProperty(_Parent, as_gId){
	
	this.oParent;
	
	if(_Parent == null) return;
	if(typeof _Parent == "string") this.oParent = document.getElementById(_Parent);
	else this.oParent = _Parent;
	
	this.gId;
	if(typeof as_gId == "string") this.gId = as_gId;
	else this.gId = "Grid_"+gi_GridIndex++;
	
	this.iFixedCols =0;//扩展列数 
	this.iFixedRows = 0;//扩展行数（只读）
	
	this.iRows = 0;//总行数
	this.iCols = 0;//总列数 （只读）
	
	this.iRow = 0;//选定行
	this.iCol = 0;//选定列
	
	this.gridCss = null;//grid样式
	this.colCss = null;//行样式
	this.cellCss = null;//格样式
	this.titleCss = null;//grid头样式
	
	this.rowHeight = 0;//行高度
	
	this.lineColor = null;//线颜色
	this.lineWidth = 0;//线宽度，单位px
	this.boxColor = null;//外框颜色
	this.boxWidth = 0;//外框宽度，单位px
	
	this.Top = "";//grid左上顶点纵坐标
	this.Left = "";//grid左上顶点横坐标
	this.gridWidth = "";//grid宽度
	this.gridHeight = "";//grid高度
	
	this.Title = new Array();//标题栏Array[][]
	this.headCss = new Array();//head各列显示样式集合
	
	this.headBgColor = new Array();//grid头背景色
	this.headFontColor = new Array();//grid头字体颜色
	this.headFontFamily = new Array();//grid头字体
		
}
/**
 * 使用标题字符串格式化标题栏,列之间以/t分割，行之间以/r分割
 * @param {String} as_Title
 */
gProperty.prototype.setTitleFrS=function(as_Title){
	if(typeof as_Title == "undefined" && isNull(as_Title))return false;
	var arr_TRows = as_Title.split("\r");
	if (typeof arr_TRows == "object") {
		var TCols = 0;
		var i = 0;
		for (i = 0; i < arr_TRows.length; i++) {
			var arrTCols = arr_TRows[i].split("\t");
			if(TCols != 0){
				if(arrTCols.length != TCols){
					if(typeof Gmsg != "undefined")alert(Gmsg[0]);
					return false;
				}
			}
			TCols = arrTCols.length;
			this.Title.push(arrTCols);
		}
		this.Cols = TCols;
		this.Rows = i;
		this.FixedRow = i;
	}	
	return true;
}
/**
 * 以二维数组形式创建title
 * @param {Array} arr_Title[][]
 */
gProperty.prototype.setTitleFrArr=function(arr_Title){
	if(typeof arr_Title == "undefined" && isNull(arr_Title))return false;
	if (typeof arr_Title == "object") {
		var TCols = 0;
		var i = 0;
		for (i = 0; i < arr_Title.length; i++) {
			if(TCols != 0){
				if(arr_Title[i].length != TCols){
					if(typeof Gmsg != "undefined")alert(Gmsg[0]);
					return false;
				}
			}
			TCols = arr_Title[i].length;
			this.Title.push(arr_Title[i]);
		}
		this.Cols = TCols;
		this.Rows = i;
		this.FixedRow = i;
	}	
	
	return true;
}
	

